<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>REGISTER</title>
<link href="css/register.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- -->
<script>
	var __links = document.querySelectorAll('a');
	function __linkClick(e) {
		parent.window.postMessage(this.href, '*');
	};
	for (var i = 0, l = __links.length; i < l; i++) {
		if (__links[i].getAttribute('data-t') == '_blank') {
			__links[i].addEventListener('click', __linkClick, false);
		}
	}
</script>
<script src="js/jquery.min.js"></script>
<script>
	$(document).ready(function(c) {
		$('.alert-close').on('click', function(c) {
			$('.message').fadeOut('slow', function(c) {
				$('.message').remove();
			});
		});
	});
</script>
</head>
<body>
	<!-- contact-form -->
	<div class="message warning">
		<div class="inset">
			<div class="login-head">
				<h1>Registered</h1>
				<div class="alert-close"></div>
			</div>
			<form>
				<li><input type="text" id="userName" value="userName"
					onfocus="this.value = '';"
					onblur="if (this.value == '') {this.value = 'userName';}"><a
					href="#" class=" icon user"></a></li>
				<div class="clear"></div>
				<li><input type="password" id="password" value="Password"
					onfocus="this.value = '';"
					onblur="if (this.value == '') {this.value = 'password';}">
					<a href="#" class="icon lock"></a></li>
				<div class="clear"></div>
				<li><input type="password" id="passwordAgain"
					value="passwordAgain" onfocus="this.value = '';"
					onblur="if (this.value == '') {this.value = 'passwordAgain';}">
					<a href="#" class="icon lock"></a></li>
				<div class="submit">
					<input type="button" onclick="register()" value="register">
					<span style="color:red;font-size: 13px; font-family: sans-serif;">IF YOU WANT COMEBACK! PLEASE CLICK--></span>
					<br/>
					<input type="button" style="float:right;" onclick="login()" value="GOTO LOGIN!">
					<div class="clear"></div>
				</div>
			</form>
		</div>
	</div>
	<div class="clear"></div>
	<!--- footer --->
	<div class="footer">
		<p>Copyright &copy; 2014.</p>
	</div>
	<div style="display: none">
		<script src='http://v7.cnzz.com/stat.php?id=155540&web_id=155540'
			language='JavaScript' charset='gb2312'></script>
	</div>
</body>
<script src="js/jquery-1.10.2.min.js"></script>
<script>
	function register() {
		var userName = $("#userName").val();
		var password = $("#password").val();
		var passwordAgain = $("#passwordAgain").val();
		if (password != passwordAgain) {
			alert("两次输入密码不正确！");
		} else if (password == "") {
			alert("密码不能为空！")
		} else {
			var data = {
				userName : userName,
				password : password
			}
			$.get("validationOf.do", data, function(result) {
				if (result != "9999") {
					alert("注册成功,您的工号是：" + result);
					window.location.href = 'login.do';
				} else {
					alert("用户名存在！");
					window.location.href = 'register.do';
				}
			})
		}
	}
	function login() {
		window.location.href = 'login.do';
	}
</script>
</html>